﻿// -----------------------------------------------------------------------
// <copyright file="Logger.cs" company="FCIS">
// You are welcome to do whatever you want with the code in this file
// </copyright>
// -----------------------------------------------------------------------

namespace ImagePackage.Utilities
{
    using System;

    /// <summary>
    /// Utility class exposing loggers
    /// </summary>
    public static class Logger
    {
        /// <summary>
        /// The logger object
        /// </summary>
        private static readonly log4net.ILog logger;

        /// <summary>
        /// Initializes static members of the <see cref="Logger"/> class.
        /// </summary>
        static Logger()
        {
           logger  = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
        }

        /// <summary>
        /// Logs the exception.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="exception">The exception.</param>
        public static void LogException(string message, Exception exception)
        {
            logger.Fatal(message, exception);
        }

        /// <summary>
        /// Logs the specified message with info level.
        /// </summary>
        /// <param name="message">The message.</param>
        public static void Info(object message)
        {
            logger.Info(message);
        }

        /// <summary>
        /// Logs the specified message with debug level.
        /// </summary>
        /// <param name="message">The message.</param>
        public static void Debug(object message)
        {
            logger.Debug(message);
        }

        /// <summary>
        /// Logs the specified message with error level.
        /// </summary>
        /// <param name="message">The message.</param>
        public static void Error(object message)
        {
            logger.Error(message);
        }

        /// <summary>
        /// Logs the specified message with warn level.
        /// </summary>
        /// <param name="message">The message.</param>
        public static void Warn(object message)
        {
            logger.Warn(message);
        }

        /// <summary>
        /// Logs the specified message with fatal level
        /// </summary>
        /// <param name="message">The message.</param>
        public static void Fatal(object message)
        {
            logger.Fatal(message);
        }
    }
}
